﻿namespace Harness
{
    using System;
    using System.Runtime.InteropServices;
    using mshtml;
    using SHDocVw;

    /// <summary>
    /// IHarness Interface
    /// </summary>
    [Guid("0515C1D2-4466-48B2-B3E6-16B14915EFD4")]
    public interface IHarness
    {
        #region Events

        event ElementHighlightEventHandler ElementHighlighted;

        #endregion

        #region Properties

        /// <summary>
        /// Gets or sets base url 
        /// </summary>
        string BaseUrl { get; set; }

        /// <summary>
        /// Gets or sets timeout seconds
        /// </summary>
        int TimeoutSeconds { get; set; }

        /// <summary>
        /// Gets harness version
        /// </summary>
        Version Version { get; }

        #endregion

        #region Methods

        /// <summary>
        /// execute command
        /// </summary>
        /// <param name="cmd">command name</param>
        /// <param name="arg1">argument 1 (optional)</param>
        /// <param name="arg2">argument 2 (optional)</param>
        /// <param name="arg3">argument 3 (optional)</param>
        /// <param name="arg4">argument 4 (optional)</param>
        /// <param name="arg5">argument 5 (optional)</param>
        /// <returns>result object</returns>
        dynamic Command(string cmd, object arg1 = null, object arg2 = null, object arg3 = null, object arg4 = null, object arg5 = null);

        void SyntaxCheck(string cmd, object arg1 = null, object arg2 = null, object arg3 = null, object arg4 = null, object arg5 = null);

        /// <summary>
        /// Gets the absolute URL supplemented with BaseUrl property
        /// </summary>
        /// <param name="url">A relative or absolute URL</param>
        /// <returns>absolute URL</returns>
        string GetAbsoluteUrl(string url);

        void HighlightElement(IHTMLElement element, string cmd = "");

        #endregion
    }
}
